package com.gpnu7_412.yanzhi.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gpnu7_412.yanzhi.entity.User;
import com.gpnu7_412.yanzhi.entity.UserDetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author HJJ
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserMessageDto {
    private Integer userId;
    private String userName;
    private String avatar;
    private String email;
    @JsonIgnore
    private String password;
    private String permission;
    private Integer dynamicNum;
    private Integer fansNum;
    private String autograph;
    private String sex;

    public UserMessageDto(User user, UserDetail userDetail) {
        this.userId = user.getUserId();
        this.userName = user.getUserName();
        this.avatar = user.getAvatar();
        this.email = user.getEmail();
        this.password = user.getPassword();
        this.permission = user.getPermission();

        this.dynamicNum = userDetail.getDynamicNum();
        this.fansNum = userDetail.getFansNum();
        this.autograph = userDetail.getAutograph();
        this.sex = userDetail.getSex();
    }
}
